package com.qys.livesMall.shop.dao.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qys.livesMall.shop.dao.H2ShopLevelDao;
import com.qys.livesMall.shop.mapper.H2ShopLevelMapper;
import com.qys.livesMall.shop.modal.entity.H2ShopLevel;
import org.springframework.stereotype.Service;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wzy
 * @since 2023-04-05
 */
@Service
public class H2ShopLevelDaoImpl extends ServiceImpl<H2ShopLevelMapper, H2ShopLevel> implements H2ShopLevelDao {


    @Override
    public H2ShopLevel getBaseLevel() {
        LambdaQueryWrapper<H2ShopLevel> qw=new LambdaQueryWrapper();
        qw.eq(H2ShopLevel::getNextLevel,-1);
        qw.last("limit 1");
        return getOne(qw);
    }

    @Override
    public H2ShopLevel getUpOneLevel(Integer id) {
        LambdaQueryWrapper<H2ShopLevel> qw=new LambdaQueryWrapper();
        qw.eq(H2ShopLevel::getNextLevel,id);
        qw.last("limit 1");
        return getOne(qw);
    }

    @Override
    public H2ShopLevel getByLevel(Integer level) {
        LambdaQueryWrapper<H2ShopLevel> qw=new LambdaQueryWrapper();
        qw.eq(H2ShopLevel::getLevel,level);
        qw.last("limit 1");
        return getOne(qw);
    }
}
